
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>JDBC · MLSQL Console 文档</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-lightbox/css/lightbox.min.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-emphasize/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-auto-scroll-table/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-page-footer-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../styles/website.css">
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="es.html" />
    
    
    <link rel="prev" href="./" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    MLSQL Stack
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">产品信息</li>
        
        
    
        <li class="chapter " data-level="2.1" >
            
                <a target="_blank" href="http://blog.mlsql.tech">
            
                    
                    MLSQL官方博客
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" >
            
                <a target="_blank" href="http://blog.mlsql.tech/blog/demo.html">
            
                    
                    MLSQL Stack体验站点
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">版本以及部署</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../release-notes/">
            
                <a href="../release-notes/">
            
                    
                    所有版本
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.1" data-path="../release-notes/version.html">
            
                <a href="../release-notes/version.html">
            
                    
                    MLSQL Stack版本管理策略
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.2" data-path="../release-notes/2.0.1.html">
            
                <a href="../release-notes/2.0.1.html">
            
                    
                    MLSQL Stack 2.0.1版发布
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3" data-path="../release-notes/2.0.0.html">
            
                <a href="../release-notes/2.0.0.html">
            
                    
                    MLSQL Stack 2.0.0版发布
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.4" data-path="../release-notes/2.0.1-bug.html">
            
                <a href="../release-notes/2.0.1-bug.html">
            
                    
                    MLSQL Stack 2.0.1 Bug 合集
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.5" data-path="../release-notes/2.0.0-bug.html">
            
                <a href="../release-notes/2.0.0-bug.html">
            
                    
                    MLSQL Stack 2.0.0 Bug 合集
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="../howtouse/">
            
                <a href="../howtouse/">
            
                    
                    基本安装
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.2.1" data-path="../howtouse/install.html">
            
                <a href="../howtouse/install.html">
            
                    
                    MLSQL Console 安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.2" data-path="../howtouse/setup.html">
            
                <a href="../howtouse/setup.html">
            
                    
                    MLSQL Console 初始配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.3" data-path="../howtouse/engine/">
            
                <a href="../howtouse/engine/">
            
                    
                    MLSQL Engine 安装与配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.2.3.1" data-path="../howtouse/engine/configuration.html">
            
                <a href="../howtouse/engine/configuration.html">
            
                    
                    启动参数详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.3.2" data-path="../howtouse/engine/deploy.html">
            
                <a href="../howtouse/engine/deploy.html">
            
                    
                    Local
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.3.3" data-path="../howtouse/engine/k8s_deploy.html">
            
                <a href="../howtouse/engine/k8s_deploy.html">
            
                    
                    K8s部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.3.4" data-path="../howtouse/engine/yarn_deploy.html">
            
                <a href="../howtouse/engine/yarn_deploy.html">
            
                    
                    Yarn部署
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">操作指南</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../analysis-workshop/">
            
                <a href="../analysis-workshop/">
            
                    
                    Analysis Workshop使用
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.1" data-path="../analysis-workshop/interface.html">
            
                <a href="../analysis-workshop/interface.html">
            
                    
                    软件界面介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.2" data-path="../analysis-workshop/admin-engine.html">
            
                <a href="../analysis-workshop/admin-engine.html">
            
                    
                    Admin管理后台之Engine配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.3" data-path="../analysis-workshop/simple-example.html">
            
                <a href="../analysis-workshop/simple-example.html">
            
                    
                    简单使用示例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.4" data-path="../analysis-workshop/pivot.html">
            
                <a href="../analysis-workshop/pivot.html">
            
                    
                    透视表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.5" data-path="../analysis-workshop/dash.html">
            
                <a href="../analysis-workshop/dash.html">
            
                    
                    可视化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6" data-path="../analysis-workshop/window.html">
            
                <a href="../analysis-workshop/window.html">
            
                    
                    使用窗口进行数据分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.7" data-path="../analysis-workshop/complex-filter.html">
            
                <a href="../analysis-workshop/complex-filter.html">
            
                    
                    复杂组合条件过滤
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.8" data-path="../analysis-workshop/ds-mysql.html">
            
                <a href="../analysis-workshop/ds-mysql.html">
            
                    
                    MySQL数据库配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.9" data-path="../analysis-workshop/json-fields.html">
            
                <a href="../analysis-workshop/json-fields.html">
            
                    
                    Json字段展开
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.10" data-path="../analysis-workshop/aw-plugin.html">
            
                <a href="../analysis-workshop/aw-plugin.html">
            
                    
                    用MLSQL为Analysis Workshop开发插件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="../console/">
            
                <a href="../console/">
            
                    
                    MLSQL语言控制台使用
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.2.1" data-path="../console/interface.html">
            
                <a href="../console/interface.html">
            
                    
                    界面简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2.2" data-path="../console/simple-example.html">
            
                <a href="../console/simple-example.html">
            
                    
                    简单使用示例
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">MLSQL语法以及编程教程</li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../lang/">
            
                <a href="../lang/">
            
                    
                    MLSQL语法手册
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1.1" data-path="../lang/set.html">
            
                <a href="../lang/set.html">
            
                    
                    Set语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.2" data-path="../lang/load.html">
            
                <a href="../lang/load.html">
            
                    
                    Load语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.3" data-path="../lang/select.html">
            
                <a href="../lang/select.html">
            
                    
                    Select语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.4" data-path="../lang/et_statement.html">
            
                <a href="../lang/et_statement.html">
            
                    
                    Train/Run/Predict语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.5" data-path="../lang/register.html">
            
                <a href="../lang/register.html">
            
                    
                    Register语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.6" data-path="../lang/save.html">
            
                <a href="../lang/save.html">
            
                    
                    Save语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.7" data-path="../lang/macro.html">
            
                <a href="../lang/macro.html">
            
                    
                    宏语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.8" data-path="../lang/include.html">
            
                <a href="../lang/include.html">
            
                    
                    Include语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.9" >
            
                <a target="_blank" href="http://blog.mlsql.tech/blog/mlsql-ifelse.html">
            
                    
                    分支语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.10" data-path="../lang/analyze.html">
            
                <a href="../lang/analyze.html">
            
                    
                    MLSQL语法解析接口
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="../batch/">
            
                <a href="../batch/">
            
                    
                    MLSQL批处理编程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.2.1" data-path="../datahouse/">
            
                <a href="../datahouse/">
            
                    
                    MLSQL数仓/数据湖使用
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.2.1.1" data-path="../datahouse/hive.html">
            
                <a href="../datahouse/hive.html">
            
                    
                    Hive加载和存储
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2.1.2" data-path="../datahouse/delta.html">
            
                <a href="../datahouse/delta.html">
            
                    
                    Delta加载和存储以及流式支持
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2.1.3" data-path="../datahouse/binlog.html">
            
                <a href="../datahouse/binlog.html">
            
                    
                    MySQL Binlog同步
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.2.2" data-path="./">
            
                <a href="./">
            
                    
                    加载和存储多种数据源
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="5.2.2.1" data-path="jdbc.html">
            
                <a href="jdbc.html">
            
                    
                    JDBC
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2.2.2" data-path="es.html">
            
                <a href="es.html">
            
                    
                    ElasticSearch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2.2.3" data-path="solr.html">
            
                <a href="solr.html">
            
                    
                    Solr
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2.2.4" data-path="hbase.html">
            
                <a href="hbase.html">
            
                    
                    HBase
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2.2.5" data-path="mongodb.html">
            
                <a href="mongodb.html">
            
                    
                    MongoDB
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2.2.6" data-path="file.html">
            
                <a href="file.html">
            
                    
                    Parquet/Json/Text/Xml/Csv
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2.2.7" data-path="mlsql_source.html">
            
                <a href="mlsql_source.html">
            
                    
                    jsonStr/script/mlsqlAPI/mlsqlConf
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.2.3" data-path="../system_udf/">
            
                <a href="../system_udf/">
            
                    
                    内置常见UDF
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.2.3.1" data-path="../system_udf/http.html">
            
                <a href="../system_udf/http.html">
            
                    
                    http请求
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2.3.2" data-path="../system_udf/vec.html">
            
                <a href="../system_udf/vec.html">
            
                    
                    常见函数
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.2.4" data-path="../process/">
            
                <a href="../process/">
            
                    
                    一些有用的内置ET
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.2.4.1" data-path="../process/estimator_transformer/TreeBuildExt.html">
            
                <a href="../process/estimator_transformer/TreeBuildExt.html">
            
                    
                    计算复杂的父子关系
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2.4.2" data-path="../process/estimator_transformer/RepartitionExt.html">
            
                <a href="../process/estimator_transformer/RepartitionExt.html">
            
                    
                    改变表的分区数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2.4.3" data-path="../process/estimator_transformer/SendMessage.html">
            
                <a href="../process/estimator_transformer/SendMessage.html">
            
                    
                    如何发送邮件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2.4.4" data-path="../process/estimator_transformer/mlsql-watcher.html">
            
                <a href="../process/estimator_transformer/mlsql-watcher.html">
            
                    
                    数据采集组件mlsql-watcher使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="../stream/">
            
                <a href="../stream/">
            
                    
                    MLSQL流编程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.3.1" data-path="../stream/datasource.html">
            
                <a href="../stream/datasource.html">
            
                    
                    Kafka和MockStream
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.3.2" data-path="../stream/kakfa_tool.html">
            
                <a href="../stream/kakfa_tool.html">
            
                    
                    MLSQL Kafka小工具集锦
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.3.3" data-path="../stream/data_convert.html">
            
                <a href="../stream/data_convert.html">
            
                    
                    自动将Kafka中的JSON数据展开为表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.3.4" data-path="../stream/query_kafka.html">
            
                <a href="../stream/query_kafka.html">
            
                    
                    如何高效的AdHoc查询Kafka
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.3.5" data-path="../stream/callback.html">
            
                <a href="../stream/callback.html">
            
                    
                    如何设置流式计算回调
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.3.6" data-path="../stream/batch.html">
            
                <a href="../stream/batch.html">
            
                    
                    如何对流的结果以批的形式保存
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.3.7" data-path="../stream/window_wartermark.html">
            
                <a href="../stream/window_wartermark.html">
            
                    
                    window/watermark的使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.3.8" data-path="../stream/stream_mysql_update.html">
            
                <a href="../stream/stream_mysql_update.html">
            
                    
                    如何使用MLSQL流式更新MySQL数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.3.9" data-path="../stream/web_console.html">
            
                <a href="../stream/web_console.html">
            
                    
                    流结果输出到WebConsole
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="../ml/">
            
                <a href="../ml/">
            
                    
                    MLSQL机器学习编程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.4.1" data-path="../feature/">
            
                <a href="../feature/">
            
                    
                    特征工程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.4.1.1" data-path="../feature/nlp.html">
            
                <a href="../feature/nlp.html">
            
                    
                    文本向量化
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.4.1.1.1" data-path="../feature/tfidf.html">
            
                <a href="../feature/tfidf.html">
            
                    
                    TFIDF
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.1.1.2" data-path="../feature/word2vec.html">
            
                <a href="../feature/word2vec.html">
            
                    
                    Word2Vec
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.4.1.2" data-path="../feature/scale.html">
            
                <a href="../feature/scale.html">
            
                    
                    特征平滑
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.1.3" data-path="../feature/normalize.html">
            
                <a href="../feature/normalize.html">
            
                    
                    归一化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.1.4" data-path="../feature/confusion_matrix.html">
            
                <a href="../feature/confusion_matrix.html">
            
                    
                    混淆矩阵
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.1.5" data-path="../feature/some_extract.html">
            
                <a href="../feature/some_extract.html">
            
                    
                    QQ/电话/邮件抽取
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.1.6" data-path="../feature/discretizer/">
            
                <a href="../feature/discretizer/">
            
                    
                    离散化
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.4.1.6.1" data-path="../feature/discretizer/bucketizer.html">
            
                <a href="../feature/discretizer/bucketizer.html">
            
                    
                    Bucketizer
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.1.6.2" data-path="../feature/discretizer/quantile.html">
            
                <a href="../feature/discretizer/quantile.html">
            
                    
                    Quantile
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.4.1.7" data-path="../feature/vecmap.html">
            
                <a href="../feature/vecmap.html">
            
                    
                    Map转化为向量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.1.8" data-path="../feature/rate_sample.html">
            
                <a href="../feature/rate_sample.html">
            
                    
                    数据集切分
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.4.2" data-path="../python/">
            
                <a href="../python/">
            
                    
                    MLSQL Python支持
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.4.2.1" data-path="../python/env.html">
            
                <a href="../python/env.html">
            
                    
                    环境依赖
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.2.2" data-path="../python/etl.html">
            
                <a href="../python/etl.html">
            
                    
                    数据处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.2.3" data-path="../python/train.html">
            
                <a href="../python/train.html">
            
                    
                    模型训练
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.2.4" data-path="../python/pyjava.html">
            
                <a href="../python/pyjava.html">
            
                    
                    PyJava API简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.2.5" data-path="../python/read_excel.html">
            
                <a href="../python/read_excel.html">
            
                    
                    结合Python读取Excel
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.2.6" data-path="../python/write_excel.html">
            
                <a href="../python/write_excel.html">
            
                    
                    结合Python保存Excel
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.2.7" data-path="../python/resource.html">
            
                <a href="../python/resource.html">
            
                    
                    K8s下的Python资源限制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.2.8" data-path="../python/datamode.html">
            
                <a href="../python/datamode.html">
            
                    
                    dataMode 详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.2.9" data-path="../python/py_paralell.html">
            
                <a href="../python/py_paralell.html">
            
                    
                    Python并行度你所需要知道的
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.4.3" data-path="../algs/">
            
                <a href="../algs/">
            
                    
                    MLSQL内置算法
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.4.3.1" data-path="../algs/naive_bayes.html">
            
                <a href="../algs/naive_bayes.html">
            
                    
                    NaiveBayes
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.3.2" data-path="../algs/als.html">
            
                <a href="../algs/als.html">
            
                    
                    ALS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.3.3" data-path="../algs/random_forest.html">
            
                <a href="../algs/random_forest.html">
            
                    
                    RandomForest
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.3.4" data-path="../algs/lda.html">
            
                <a href="../algs/lda.html">
            
                    
                    LDA
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.3.5" data-path="../algs/xgboost.html">
            
                <a href="../algs/xgboost.html">
            
                    
                    XGBoost
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.4.4" data-path="../dl/">
            
                <a href="../dl/">
            
                    
                    基于Java的深度学习框架集成
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.4.4.1" data-path="../dl/load_image.html">
            
                <a href="../dl/load_image.html">
            
                    
                    加载图片数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.4.2" data-path="../dl/cifar10.html">
            
                <a href="../dl/cifar10.html">
            
                    
                    Cifar10示例
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.4.5" data-path="../api_deploy/">
            
                <a href="../api_deploy/">
            
                    
                    部署算法API服务
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.4.5.1" data-path="../api_deploy/design.html">
            
                <a href="../api_deploy/design.html">
            
                    
                    设计和原理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4.5.2" data-path="../api_deploy/case.html">
            
                <a href="../api_deploy/case.html">
            
                    
                    部署流程
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.5" data-path="../udf/">
            
                <a href="../udf/">
            
                    
                    MLSQL动态创建UDF/UDAF
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.5.1" data-path="../udf/python_udf.html">
            
                <a href="../udf/python_udf.html">
            
                    
                    Python UDF
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.5.2" data-path="../udf/scala_udf.html">
            
                <a href="../udf/scala_udf.html">
            
                    
                    Scala UDF
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.5.3" data-path="../udf/scala_udaf.html">
            
                <a href="../udf/scala_udaf.html">
            
                    
                    Scala UDAF
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.5.4" data-path="../udf/java_udf.html">
            
                <a href="../udf/java_udf.html">
            
                    
                    Java UDF
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">安全与隐私</li>
        
        
    
        <li class="chapter " data-level="6.1" data-path="../security/sum.html">
            
                <a href="../security/sum.html">
            
                    
                    安全与隐私
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1.1" data-path="../security/">
            
                <a href="../security/">
            
                    
                    MLSQL Engine 接口访问控制
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1.1.1" data-path="../security/token_control.html">
            
                <a href="../security/token_control.html">
            
                    
                    接口访问Token设置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.1.2" data-path="../security/custom_control.html">
            
                <a href="../security/custom_control.html">
            
                    
                    自定义接口访问策略
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.1.2" data-path="../security/sum2.html">
            
                <a href="../security/sum2.html">
            
                    
                    授权用户对数据的访问控制
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1.2.1" >
            
                <span>
            
                    
                    解析时表权限
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.2.2" >
            
                <span>
            
                    
                    运行时表/列权限
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.2.3" >
            
                <span>
            
                    
                    客户端开发
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.2.4" >
            
                <span>
            
                    
                    服务端开发
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">性能与资源</li>
        
        
    
        <li class="chapter " data-level="7.1" data-path="../resources/dynamic_resource.html">
            
                <a href="../resources/dynamic_resource.html">
            
                    
                    动态资源调整
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">插件/API/商店</li>
        
        
    
        <li class="chapter " data-level="8.1" data-path="../store/">
            
                <a href="../store/">
            
                    
                    MLSQL 脚本商店和插件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.1.1" data-path="../store/save_excel.html">
            
                <a href="../store/save_excel.html">
            
                    
                    脚本插件save_excel
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.2" data-path="../plugin/">
            
                <a href="../plugin/">
            
                    
                    MLSQL Engine插件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.1.2.1" data-path="../plugin/online_install.html">
            
                <a href="../plugin/online_install.html">
            
                    
                    网络安装插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.2.2" data-path="../plugin/offline_install.html">
            
                <a href="../plugin/offline_install.html">
            
                    
                    离线安装插件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8.2" data-path="../api/sum.html">
            
                <a href="../api/sum.html">
            
                    
                    API on（Console/Engine）介绍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.2.1" data-path="../developer/">
            
                <a href="../developer/">
            
                    
                    MLSQL Console API指南
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.2.1.1" data-path="../developer/script_api.html">
            
                <a href="../developer/script_api.html">
            
                    
                    脚本获取接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.2.1.2" data-path="../developer/script_run_api.html">
            
                <a href="../developer/script_run_api.html">
            
                    
                    脚本执行代理接口
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8.2.2" data-path="../api/README.md">
            
                <span>
            
                    
                    MLSQL Engine Rest接口详解
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.2.2.1" data-path="../api/run-script.html">
            
                <a href="../api/run-script.html">
            
                    
                    /run/script
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8.2.3" data-path="../resources/liveness.html">
            
                <a href="../resources/liveness.html">
            
                    
                    MLSQL Engine Liveness探针
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.2.4" data-path="../resources/readiness.html">
            
                <a href="../resources/readiness.html">
            
                    
                    MLSQL Engine Readness探针
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="9.1" data-path="../qa/">
            
                <a href="../qa/">
            
                    
                    常见问题
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="9.1.1" data-path="../qa/upload_file.html">
            
                <a href="../qa/upload_file.html">
            
                    
                    文件上传失败怎么办
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.2" data-path="../qa/home.html">
            
                <a href="../qa/home.html">
            
                    
                    个人主目录是个啥
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.3" data-path="../qa/session_isolated.html">
            
                <a href="../qa/session_isolated.html">
            
                    
                    会话隔离/并发执行/调试执行/定时任务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.4" data-path="../qa/cdh_hdp.html">
            
                <a href="../qa/cdh_hdp.html">
            
                    
                    CDH/HDP 怎么运行MLSQL Engine
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.5" data-path="../qa/debug_log.html">
            
                <a href="../qa/debug_log.html">
            
                    
                    排查错误，三个系统的日志你都要看
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.6" data-path="../qa/mlsql_cluster.html">
            
                <a href="../qa/mlsql_cluster.html">
            
                    
                    听说mlsql-cluster暂时不更新了，mlsql-cluster是个啥？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="9.2" >
            
                <span>
            
                    
                    最佳实践
            
                </span>
            

            
        </li>
    

    
        
        <li class="header">附录</li>
        
        
    
        <li class="chapter " data-level="10.1" >
            
                <span>
            
                    
                    附录一：
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="10.2" >
            
                <span>
            
                    
                    附录二：
            
                </span>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >JDBC</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#jdbc"><b></b>JDBC</a></li><ul><li><span class="title-icon "></span><a href="#&#x52A0;&#x8F7D;&#x6570;&#x636E;"><b></b>&#x52A0;&#x8F7D;&#x6570;&#x636E;</a></li><li><span class="title-icon "></span><a href="#&#x4FDD;&#x5B58;&#x66F4;&#x65B0;&#x6570;&#x636E;"><b></b>&#x4FDD;&#x5B58;&#x66F4;&#x65B0;&#x6570;&#x636E;</a></li><li><span class="title-icon "></span><a href="#&#x5982;&#x4F55;&#x6267;&#x884C;upsert&#x8BED;&#x4E49;&#x76EE;&#x524D;&#x53EA;&#x652F;&#x6301;mysql"><b></b>&#x5982;&#x4F55;&#x6267;&#x884C;Upsert&#x8BED;&#x4E49;(&#x76EE;&#x524D;&#x53EA;&#x652F;&#x6301;MySQL)</a></li><li><span class="title-icon "></span><a href="#&#x5982;&#x4F55;&#x5C06;&#x6D41;&#x5F0F;&#x6570;&#x636E;&#x5199;&#x5165;mysql"><b></b>&#x5982;&#x4F55;&#x5C06;&#x6D41;&#x5F0F;&#x6570;&#x636E;&#x5199;&#x5165;MySQL</a></li></ul></ul></div><h1 id="jdbc"><a name="jdbc" class="anchor-navigation-ex-anchor" href="#jdbc"><i class="fa fa-link" aria-hidden="true"></i></a>JDBC</h1>
<h2 id="&#x52A0;&#x8F7D;&#x6570;&#x636E;"><a name="&#x52A0;&#x8F7D;&#x6570;&#x636E;" class="anchor-navigation-ex-anchor" href="#&#x52A0;&#x8F7D;&#x6570;&#x636E;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x52A0;&#x8F7D;&#x6570;&#x636E;</h2>
<p>JDBC&#x5176;&#x5B9E;&#x662F;&#x4E00;&#x7C7B;&#x6570;&#x636E;&#x6E90;&#xFF0C;&#x6BD4;&#x5982;MySQL, Oracle,Hive thrift server&#x7B49;&#x7B49;&#xFF0C;&#x53EA;&#x8981;&#x6570;&#x636E;&#x6E90;&#x652F;&#x6301;JDBC&#x534F;&#x8BAE;&#xFF0C;&#x90A3;&#x4E48;&#x5C31;&#x53EF;&#x4EE5;
&#x901A;&#x8FC7;JDBC&#x8FDB;&#x884C;&#x52A0;&#x8F7D;&#x3002;&#x5728;&#x8FD9;&#x91CC;&#xFF0C;&#x6211;&#x4EEC;&#x4F1A;&#x4EE5;MySQL&#x4E3A;&#x4E3B;&#x8981;&#x4F8B;&#x5B50;&#x8FDB;&#x884C;&#x4ECB;&#x7ECD;&#xFF0C;&#x5176;&#x4ED6;&#x4E5F;&#x4F1A;&#x63D0;&#x53CA;&#x3002;</p>
<p>&#x9996;&#x5148;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5EFA;&#x7ACB;&#x8FDE;&#x63A5;&#xFF0C;&#x8FD9;&#x662F;&#x901A;&#x8FC7;connect&#x8BED;&#x6CD5;&#x6765;&#x5B8C;&#x6210;&#x7684;&#xFF1A;</p>
<pre><code class="lang-sql"> set user=&quot;root&quot;;

 connect jdbc where
 url=&quot;jdbc:mysql://127.0.0.1:3306/wow?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;tinyInt1isBit=false&quot;
 and driver=&quot;com.mysql.jdbc.Driver&quot;
 and user=&quot;${user}&quot;
 and password=&quot;${password}&quot;
 as db_1;
</code></pre>
<p>&#x8FD9;&#x53E5;&#x8BDD;&#x8868;&#x793A;&#xFF0C;&#x6211;&#x5E0C;&#x671B;&#x8FDE;&#x63A5;jdbc&#x6570;&#x636E;&#x6E90;&#xFF0C;&#x8FDE;&#x63A5;&#x76F8;&#x5173;&#x7684;&#x53C2;&#x6570;&#x5728;where&#x8BED;&#x53E5;&#x91CC;&#xFF0C;&#x9A71;&#x52A8;&#x662F;MySQL&#x7684;&#x9A71;&#x52A8;&#xFF0C;&#x7136;&#x540E;&#x8BBE;&#x7F6E;&#x7528;&#x6237;&#x540D;&#x548C;&#x5BC6;&#x7801;&#x3002;
&#x6211;&#x4EEC;&#x628A;&#x6211;&#x4EEC;&#x8FD9;&#x4E2A;&#x94FE;&#x63A5;&#x53EB;&#x505A;db_1,&#x5176;&#x5B9E;&#x5C31;&#x662F;wow&#x7684;&#x522B;&#x540D;&#xFF0C;wow&#x662F;MySQL&#x91CC;&#x7684;&#x4E00;&#x4E2A;DB.</p>
<p>&#x63A5;&#x7740;&#x6211;&#x5C31;&#x53EF;&#x4EE5;&#x8FD9;&#x4E2A;&#x6570;&#x636E;&#x5E93;&#x91CC;&#x52A0;&#x8F7D;&#x4EFB;&#x610F;&#x8868;&#x4E86;&#xFF1A;</p>
<pre><code>load jdbc.`db_1.table1` as table1;
load jdbc.`db_1.table2` as table2;

select * from table1 as output;
</code></pre><p>&#x4E0B;&#x9762;&#x662F;&#x4E00;&#x4E9B;&#x53C2;&#x89C1;&#x53C2;&#x6570;&#xFF1A;</p>
<table>
<thead>
<tr>
<th>Property Name</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>url</td>
<td>The JDBC URL to connect to. The source-specific connection properties may be specified in the URL. e.g., jdbc:postgresql://localhost/test?user=fred&amp;password=secret</td>
</tr>
<tr>
<td>dbtable</td>
<td>The JDBC table that should be read. Note that anything that is valid in a FROM clause of a SQL query can be used. For example, instead of a full table you could also use a subquery in parentheses.</td>
</tr>
<tr>
<td>driver</td>
<td>The class name of the JDBC driver to use to connect to this URL.</td>
</tr>
<tr>
<td>partitionColumn, lowerBound, upperBound</td>
<td>These options must all be specified if any of them is specified. In addition, numPartitions must be specified. They describe how to partition the table when reading in parallel from multiple workers. partitionColumn must be a numeric column from the table in question. Notice that lowerBound and upperBound are just used to decide the partition stride, not for filtering the rows in table. So all rows in the table will be partitioned and returned. This option applies only to reading.</td>
</tr>
<tr>
<td>numPartitions</td>
<td>The maximum number of partitions that can be used for parallelism in table reading and writing. This also determines the maximum number of concurrent JDBC connections. If the number of partitions to write exceeds this limit, we decrease it to this limit by calling coalesce(numPartitions) before writing.</td>
</tr>
<tr>
<td>fetchsize</td>
<td>The JDBC fetch size, which determines how many rows to fetch per round trip. This can help performance on JDBC drivers which default to low fetch size (eg. Oracle with 10 rows). This option applies only to reading.</td>
</tr>
<tr>
<td>batchsize</td>
<td>The JDBC batch size, which determines how many rows to insert per round trip. This can help performance on JDBC drivers. This option applies only to writing. It defaults to 1000.</td>
</tr>
<tr>
<td>isolationLevel</td>
<td>The transaction isolation level, which applies to current connection. It can be one of NONE, READ_COMMITTED, READ_UNCOMMITTED, REPEATABLE_READ, or SERIALIZABLE, corresponding to standard transaction isolation levels defined by JDBC&apos;s Connection object, with default of READ_UNCOMMITTED. This option applies only to writing. Please refer the documentation in java.sql.Connection.</td>
</tr>
<tr>
<td>sessionInitStatement</td>
<td>After each database session is opened to the remote DB and before starting to read data, this option executes a custom SQL statement (or a PL/SQL block). Use this to implement session initialization code. Example: option(&quot;sessionInitStatement&quot;, &quot;&quot;&quot;BEGIN execute immediate &apos;alter session set &quot;_serial_direct_read&quot;=true&apos;; END;&quot;&quot;&quot;)</td>
</tr>
<tr>
<td>truncate</td>
<td>This is a JDBC writer related option. When SaveMode.Overwrite is enabled, this option causes Spark to truncate an existing table instead of dropping and recreating it. This can be more efficient, and prevents the table metadata (e.g., indices) from being removed. However, it will not work in some cases, such as when the new data has a different schema. It defaults to false. This option applies only to writing.</td>
</tr>
<tr>
<td>createTableOptions</td>
<td>This is a JDBC writer related option. If specified, this option allows setting of database-specific table and partition options when creating a table (e.g., CREATE TABLE t (name string) ENGINE=InnoDB.). This option applies only to writing.</td>
</tr>
<tr>
<td>createTableColumnTypes</td>
<td>The database column data types to use instead of the defaults, when creating the table. Data type information should be specified in the same format as CREATE TABLE columns syntax (e.g: &quot;name CHAR(64), comments VARCHAR(1024)&quot;). The specified types should be valid spark sql data types. This option applies only to writing.</td>
</tr>
<tr>
<td>customSchema</td>
<td>The custom schema to use for reading data from JDBC connectors. For example, &quot;id DECIMAL(38, 0), name STRING&quot;. You can also specify partial fields, and the others use the default type mapping. For example, &quot;id DECIMAL(38, 0)&quot;. The column names should be identical to the corresponding column names of JDBC table. Users can specify the corresponding data types of Spark SQL instead of using the defaults. This option applies only to reading.</td>
</tr>
</tbody>
</table>
<p>&#x5176;&#x4E2D;&#xFF0C;partitionColumn, lowerBound, upperBound,numPartitions &#x7528;&#x6765;&#x63A7;&#x5236;&#x52A0;&#x8F7D;&#x8868;&#x7684;&#x5E76;&#x884C;&#x5EA6;&#x3002;&#x5982;&#x679C;&#x4F60;
&#x52A0;&#x8F7D;&#x6570;&#x636E;&#x592A;&#x6162;&#xFF0C;&#x90A3;&#x4E48;&#x53EF;&#x4EE5;&#x8C03;&#x6574;&#x7740;&#x51E0;&#x4E2A;&#x53C2;&#x6570;&#x3002;</p>
<p>MLSQL&#x5185;&#x7F6E;&#x53C2;&#x6570;&#xFF1A;</p>
<table>
<thead>
<tr>
<th>Property Name</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>prePtnArray</td>
<td>Prepartitioned array, default comma delimited</td>
</tr>
<tr>
<td>prePtnDelimiter</td>
<td>Prepartition separator</td>
</tr>
</tbody>
</table>
<p>&#x9884;&#x5206;&#x533A;&#x4F7F;&#x7528;&#x6837;&#x4F8B;&#xFF1A;</p>
<pre><code>load jdbc.`db.table` options
and driver=&quot;com.mysql.jdbc.Driver&quot;
and url=&quot;jdbc:mysql://127.0.0.1:3306/....&quot;
and user=&quot;...&quot;
and password=&quot;....&quot;
and prePtnArray = &quot;age&lt;=10 | age &gt; 10&quot;
and prePtnDelimiter = &quot;\|&quot;
as table1;
</code></pre><p>&#x5F53;&#x7136;&#xFF0C;&#x6211;&#x4EEC;&#x4E5F;&#x53EF;&#x4EE5;&#x4E0D;&#x7528;connect&#x8BED;&#x6CD5;&#xFF0C;&#x76F4;&#x63A5;&#x4F7F;&#x7528;Load&#x8BED;&#x6CD5;&#xFF1A;</p>
<pre><code class="lang-sql"><span class="hljs-keyword">load</span> jdbc.<span class="hljs-string">`db.table`</span> options
<span class="hljs-keyword">and</span> driver=<span class="hljs-string">&quot;com.mysql.jdbc.Driver&quot;</span>
<span class="hljs-keyword">and</span> <span class="hljs-keyword">url</span>=<span class="hljs-string">&quot;jdbc:mysql://127.0.0.1:3306/....&quot;</span>
<span class="hljs-keyword">and</span> <span class="hljs-keyword">user</span>=<span class="hljs-string">&quot;...&quot;</span>
<span class="hljs-keyword">and</span> <span class="hljs-keyword">password</span>=<span class="hljs-string">&quot;....&quot;</span>
<span class="hljs-keyword">as</span> table1;
</code></pre>
<p>&#x503C;&#x5F97;&#x6CE8;&#x610F;&#x7684;&#x662F;&#xFF0C;JDBC&#x8FD8;&#x652F;&#x6301;&#x4F7F;&#x7528;MySQL&#x539F;&#x751F;SQL&#x7684;&#x65B9;&#x5F0F;&#x53BB;&#x52A0;&#x8F7D;MySQL&#x6570;&#x636E;&#x3002;&#x6BD4;&#x5982;&#xFF1A;</p>
<pre><code class="lang-sql"><span class="hljs-keyword">load</span> jdbc.<span class="hljs-string">`db_1.test1`</span> <span class="hljs-keyword">where</span> directQuery=<span class="hljs-string">&apos;&apos;&apos;
select * from test1 where a = &quot;b&quot;
&apos;&apos;&apos;</span> <span class="hljs-keyword">as</span> newtable;

<span class="hljs-keyword">select</span> * <span class="hljs-keyword">from</span> newtable;
</code></pre>
<p>&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x8981;&#x6C42;&#x52A0;&#x8F7D;&#x7684;&#x6570;&#x636E;&#x96C6;&#x4E0D;&#x80FD;&#x592A;&#x5927;&#x3002; &#x5982;&#x679C;&#x4F60;&#x5E0C;&#x671B;&#x5BF9;&#x8FD9;&#x4E2A;&#x8BED;&#x53E5;&#x4E5F;&#x8FDB;&#x884C;&#x6743;&#x9650;&#x63A7;&#x5236;&#xFF0C;&#x5982;&#x679C;&#x662F;&#x5230;&#x8868;&#x7EA7;&#x522B;&#xFF0C;&#x90A3;&#x4E48;&#x53EA;&#x8981;&#x7CFB;&#x7EDF;&#x5F00;&#x542F;&#x6388;&#x6743;&#x5373;&#x53EF;&#x3002;
&#x5982;&#x679C;&#x662F;&#x9700;&#x8981;&#x63A7;&#x5236;&#x5230;&#x5217;&#xFF0C;&#x90A3;&#x4E48;&#x542F;&#x52A8;&#x65F6;&#x9700;&#x8981;&#x6DFB;&#x52A0;&#x5982;&#x4E0B;&#x53C2;&#x6570;&#xFF1A;</p>
<pre><code>--conf &quot;spark.mlsql.enable.runtime.directQuery.auth=true&quot;
</code></pre><h2 id="&#x4FDD;&#x5B58;&#x66F4;&#x65B0;&#x6570;&#x636E;"><a name="&#x4FDD;&#x5B58;&#x66F4;&#x65B0;&#x6570;&#x636E;" class="anchor-navigation-ex-anchor" href="#&#x4FDD;&#x5B58;&#x66F4;&#x65B0;&#x6570;&#x636E;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4FDD;&#x5B58;&#x66F4;&#x65B0;&#x6570;&#x636E;</h2>
<p>&#x5982;&#x540C;&#x52A0;&#x8F7D;&#x6570;&#x636E;&#x4E00;&#x6837;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x590D;&#x7528;&#x524D;&#x9762;&#x7684;&#x6570;&#x636E;&#x8FDE;&#x63A5;&#xFF1A;</p>
<pre><code class="lang-sql"> set user=&quot;root&quot;;

 connect jdbc where
 url=&quot;jdbc:mysql://127.0.0.1:3306/wow?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;tinyInt1isBit=false&quot;
 and driver=&quot;com.mysql.jdbc.Driver&quot;
 and user=&quot;${user}&quot;
 and password=&quot;${password}&quot;
 as db_1;
</code></pre>
<p>&#x63A5;&#x7740;&#x5BF9;&#x5F97;&#x5230;&#x7684;&#x6570;&#x636E;&#x8FDB;&#x884C;&#x4FDD;&#x5B58;&#xFF1A;</p>
<pre><code>save append tmp_article_table as jdbc.`db_1.crawler_table`;
</code></pre><p>&#x8FD9;&#x53E5;&#x8BDD;&#x8868;&#x793A;&#xFF0C;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x4FDD;&#x5B58;&#xFF0C;&#x5E76;&#x4E14;&#x4F7F;&#x7528;&#x8FFD;&#x52A0;&#x7684;&#x65B9;&#x5F0F;&#xFF0C;&#x5F80; db_1&#x4E2D;&#x7684; crawler_table&#x91CC;&#x6DFB;&#x52A0;&#x6570;&#x636E;&#xFF0C;&#x8FD9;&#x4E9B;&#x6570;&#x636E;&#x6765;&#x6E90;&#x4E8E;&#x8868;
tmp_article_table&#x3002; &#x5982;&#x679C;&#x4F60;&#x9700;&#x8981;&#x8986;&#x76D6;&#x8BF7;&#x4F7F;&#x7528; </p>
<pre><code>save overwrite ....
</code></pre><p>&#x5982;&#x679C;&#x4F60;&#x5E0C;&#x671B;&#x5148;&#x521B;&#x5EFA;&#x8868;&#xFF0C;&#x7136;&#x540E;&#x518D;&#x5199;&#x5165;&#x8868;&#xFF0C;&#x90A3;&#x4E48;&#x4F60;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;ET JDBC,&#x8BE5;ET&#x672C;&#x8D28;&#x4E0A;&#x662F;&#x5728;Driver&#x7AEF;&#x6267;&#x884C;&#x5404;&#x79CD;&#x64CD;&#x4F5C;&#x6307;&#x4EE4;&#x7684;&#x3002;</p>
<pre><code>run command as JDBC.`db_1` where 
driver-statement-0=&quot;drop table test1&quot;
and driver-statement-1=&quot;create table test1.....&quot;;

save append tmp_article_table as jdbc.`db_1.test1`;
</code></pre><p>&#x8FD9;&#x6BB5;&#x8BED;&#x53E5;&#xFF0C;&#x6211;&#x4EEC;&#x5148;&#x5220;&#x9664;test1,&#x7136;&#x540E;&#x521B;&#x5EFA;test1,&#x6700;&#x540E;&#x4F7F;&#x7528;save&#x8BED;&#x53E5;&#x628A;&#x8FDB;&#x884C;&#x6570;&#x636E;&#x7ED3;&#x679C;&#x7684;&#x4FDD;&#x5B58;&#x3002;</p>
<h2 id="&#x5982;&#x4F55;&#x6267;&#x884C;upsert&#x8BED;&#x4E49;&#x76EE;&#x524D;&#x53EA;&#x652F;&#x6301;mysql"><a name="&#x5982;&#x4F55;&#x6267;&#x884C;upsert&#x8BED;&#x4E49;&#x76EE;&#x524D;&#x53EA;&#x652F;&#x6301;mysql" class="anchor-navigation-ex-anchor" href="#&#x5982;&#x4F55;&#x6267;&#x884C;upsert&#x8BED;&#x4E49;&#x76EE;&#x524D;&#x53EA;&#x652F;&#x6301;mysql"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5982;&#x4F55;&#x6267;&#x884C;Upsert&#x8BED;&#x4E49;(&#x76EE;&#x524D;&#x53EA;&#x652F;&#x6301;MySQL)</h2>
<p>&#x8981;&#x8BA9;MLSQL&#x5728;&#x4FDD;&#x5B58;&#x6570;&#x636E;&#x65F6;&#x6267;&#x884C;Upsert&#x8BED;&#x4E49;&#x7684;&#x8BDD;&#xFF0C;&#x4F60;&#x53EA;&#x9700;&#x8981;&#x63D0;&#x4F9B;&#x63D0;&#x4F9B;idCol&#x5B57;&#x6BB5;&#x5373;&#x53EF;&#x3002;&#x4E0B;&#x9762;&#x662F;&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x4F8B;&#x5B50;&#xFF1A;</p>
<pre><code class="lang-sql">save append tmp_article_table as jdbc.`db_1.test1`
where idCol=&quot;a,b,c&quot;;
</code></pre>
<p>MLSQL&#x5185;&#x90E8;&#x4F7F;&#x7528;&#x4E86;MySQL&#x7684;duplicate key&#x8BED;&#x6CD5;&#xFF0C;&#x6240;&#x4EE5;&#x7528;&#x6237;&#x9700;&#x8981;&#x5BF9;&#x5E94;&#x7684;&#x6570;&#x636E;&#x5E93;&#x8868;&#x786E;&#x5B9E;&#x6709;&#x91CD;&#x590D;&#x8054;&#x5408;&#x4E3B;&#x952E;&#x7684;&#x7EA6;&#x675F;&#x3002;&#x90A3;&#x5982;&#x679C;&#x6CA1;&#x6709;&#x5B9E;&#x73B0;&#x5728;&#x6570;&#x636E;&#x5E93;&#x5C42;&#x9762;&#x5B9A;&#x4E49;&#x8054;&#x5408;&#x7EA6;&#x675F;&#x4E3B;&#x952E;&#x5462;&#xFF1F;
&#x7ED3;&#x679C;&#x4F1A;&#x662F;&#x6570;&#x636E;&#x4E0D;&#x65AD;&#x589E;&#x52A0;&#xFF0C;&#x800C;&#x6CA1;&#x6709;&#x6267;&#x884C;update&#x64CD;&#x4F5C;&#x3002;</p>
<p>idCol&#x7684;&#x4F5C;&#x7528;&#x6709;&#x4E24;&#x4E2A;&#xFF0C;&#x4E00;&#x4E2A;&#x662F;&#x6807;&#x8BB0;&#xFF0C;&#x6807;&#x8BB0;&#x6570;&#x636E;&#x9700;&#x8981;&#x6267;&#x884C;Upsert&#x64CD;&#x4F5C;&#xFF0C;&#x7B2C;&#x4E8C;&#x4E2A;&#x662F;&#x786E;&#x5B9A;&#x9700;&#x8981;&#x7684;&#x66F4;&#x65B0;&#x5B57;&#x6BB5;&#xFF0C;&#x56E0;&#x4E3A;&#x4E3B;&#x952E;&#x81EA;&#x8EAB;&#x7684;&#x5B57;&#x6BB5;&#x662F;&#x4E0D;&#x9700;&#x8981;&#x66F4;&#x65B0;&#x7684;&#x3002;MLSQL&#x4F1A;&#x5C06;&#x8868;&#x6240;&#x6709;&#x7684;&#x5B57;&#x6BB5;&#x51CF;&#x53BB;
idCol&#x5B9A;&#x4E49;&#x7684;&#x5B57;&#x6BB5;&#xFF0C;&#x5F97;&#x5230;&#x9700;&#x8981;&#x66F4;&#x65B0;&#x7684;&#x5B57;&#x6BB5;&#x3002;</p>
<h2 id="&#x5982;&#x4F55;&#x5C06;&#x6D41;&#x5F0F;&#x6570;&#x636E;&#x5199;&#x5165;mysql"><a name="&#x5982;&#x4F55;&#x5C06;&#x6D41;&#x5F0F;&#x6570;&#x636E;&#x5199;&#x5165;mysql" class="anchor-navigation-ex-anchor" href="#&#x5982;&#x4F55;&#x5C06;&#x6D41;&#x5F0F;&#x6570;&#x636E;&#x5199;&#x5165;mysql"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5982;&#x4F55;&#x5C06;&#x6D41;&#x5F0F;&#x6570;&#x636E;&#x5199;&#x5165;MySQL</h2>
<p>&#x4E0B;&#x9762;&#x6709;&#x4E2A;&#x975E;&#x5E38;&#x7B80;&#x5355;&#x7684;&#x4F8B;&#x5B50;&#xFF1A;</p>
<pre><code>set streamName=&quot;mysql-test&quot;;

.......

save append table21  
as streamJDBC.`mysql1.test1` 
options mode=&quot;Complete&quot;
and `driver-statement-0`=&quot;create table  if not exists test1(k TEXT,c BIGINT)&quot;
and `statement-0`=&quot;insert into wow.test1(k,c) values(?,?)&quot;
and duration=&quot;3&quot;
and checkpointLocation=&quot;/tmp/cpl3&quot;;
</code></pre><p>&#x6211;&#x4EEC;&#x4F7F;&#x7528;streamJDBC&#x6570;&#x636E;&#x6E90;&#x53EF;&#x4EE5;&#x5B8C;&#x6210;&#x5C06;&#x6570;&#x636E;&#x5199;&#x5165;&#x5230;MySQL&#x4E2D;&#x3002;driver-statement-0 &#x5728;&#x6574;&#x4E2A;&#x8FD0;&#x884C;&#x671F;&#x95F4;&#x53EA;&#x4F1A;&#x6267;&#x884C;&#x4E00;&#x6B21;&#x3002;statement-0
&#x5219;&#x4F1A;&#x9488;&#x5BF9;&#x6BCF;&#x6761;&#x8BB0;&#x5F55;&#x6267;&#x884C;&#x3002; insert&#x8BED;&#x53E5;&#x4E2D;&#x7684;&#x5360;&#x4F4D;&#x7B26;&#x987A;&#x5E8F;&#x9700;&#x8981;&#x548C;table21&#x4E2D;&#x7684;&#x5217;&#x987A;&#x5E8F;&#x4FDD;&#x6301;&#x4E00;&#x81F4;&#x3002;</p>
<footer class="page-footer-ex"> <span class="page-footer-ex-copyright">  </span> &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0; <span class="page-footer-ex-footer-update"> <i>&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;</i> 2019-08-30 10:00:00 </span> </footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="./" class="navigation navigation-prev " aria-label="Previous page: 加载和存储多种数据源">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="es.html" class="navigation navigation-next " aria-label="Next page: ElasticSearch">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"JDBC","level":"5.2.2.1","depth":3,"next":{"title":"ElasticSearch","level":"5.2.2.2","depth":3,"path":"datasource/es.md","ref":"datasource/es.md","articles":[]},"previous":{"title":"加载和存储多种数据源","level":"5.2.2","depth":2,"path":"datasource/README.md","ref":"datasource/README.md","articles":[{"title":"JDBC","level":"5.2.2.1","depth":3,"path":"datasource/jdbc.md","ref":"datasource/jdbc.md","articles":[]},{"title":"ElasticSearch","level":"5.2.2.2","depth":3,"path":"datasource/es.md","ref":"datasource/es.md","articles":[]},{"title":"Solr","level":"5.2.2.3","depth":3,"path":"datasource/solr.md","ref":"datasource/solr.md","articles":[]},{"title":"HBase","level":"5.2.2.4","depth":3,"path":"datasource/hbase.md","ref":"datasource/hbase.md","articles":[]},{"title":"MongoDB","level":"5.2.2.5","depth":3,"path":"datasource/mongodb.md","ref":"datasource/mongodb.md","articles":[]},{"title":"Parquet/Json/Text/Xml/Csv","level":"5.2.2.6","depth":3,"path":"datasource/file.md","ref":"datasource/file.md","articles":[]},{"title":"jsonStr/script/mlsqlAPI/mlsqlConf","level":"5.2.2.7","depth":3,"path":"datasource/mlsql_source.md","ref":"datasource/mlsql_source.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["-sharing","image-class","lightbox","back-to-top-button","chapter-fold","code","-lunr","-search","search-pro","emphasize","splitter","auto-scroll-table","anchor-navigation-ex","emphasize","alerts","page-footer-ex"],"styles":{"website":"styles/website.css"},"pluginsConfig":{"chapter-fold":{},"emphasize":{},"image-class":{},"page-footer-ex":{"copyright":"","markdown":false,"update_format":"YYYY-MM-DD HH:mm:ss","update_label":"<i>该文件修订时间：</i>"},"splitter":{},"search-pro":{},"auto-scroll-table":{},"code":{"copyButtons":true},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"fa fa-hand-o-right","level2Icon":"fa fa-hand-o-right","level3Icon":"fa fa-hand-o-right","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":false,"showLevel":false},"lightbox":{"jquery":true,"sameUuid":false},"back-to-top-button":{},"alerts":{},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"MLSQL Console 文档","gitbook":"*","description":"MLSQL Console官方文档"},"file":{"path":"datasource/jdbc.md","mtime":"2019-08-30T02:00:00.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-11-12T02:48:47.904Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-lightbox/js/lightbox.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-auto-scroll-table/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-alerts/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

